-
Notifications
You must be signed in to change notification settings - Fork 1
fix(7tv): use correct user ID for cosmetic subscriptions #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Change streamerData.id to streamerData.user_id for 7TV cosmetic subscriptions - Handle both entitlement.create and entitlement.delete events - Add removeUserStyle method for proper cosmetic removal - This fixes 7TV badges and paints not appearing due to wrong subscription IDs
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds handling for 7TV/Kick Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant STV as 7TV Shared WS
participant CP as ChatProvider
participant CS as CosmeticsStore
Note over STV,CP: Entitlement event (kind 10)
STV->>CP: message(detail.type = entitlement.create|entitlement.delete, body)
alt entitlement.create
CP->>CS: addUserStyle(username, body)
CS-->>CP: style added/updated
else entitlement.delete
rect rgba(200,230,255,0.25)
note right of CP: New handling: remove on delete
CP->>CS: removeUserStyle(username, body)
end
CS-->>CP: style removed/updated
end
sequenceDiagram
autonumber
participant Kick as Kick WS (shared)
participant CP as ChatProvider
participant CS as CosmeticsStore
Kick->>CP: entitlement.delete (body with user.connections[KICK])
CP->>CP: derive username (dashes→underscores, toLowerCase)
CP->>CS: removeUserStyle(username, body)
CS-->>CP: user entry updated or pruned
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
| removeUserStyle: (username, body) => { | ||
| const transformedUsername = username.toLowerCase(); | ||
| const refId = body?.object?.ref_id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] Guard against missing usernames before lowercasing
The new removeUserStyle action assumes the username argument is always defined and immediately calls username.toLowerCase(). However, handleStvMessage derives the username from body.object.user.connections on entitlement.delete events, and those payloads are not guaranteed to include a Kick connection (for example, when the 7TV event only carries a user_id). When such an event arrives, the provider will throw Cannot read properties of undefined (reading 'toLowerCase'), breaking cosmetic updates for all chatrooms. Consider short‑circuiting when username is falsy before transforming it.
Useful? React with 👍 / 👎.
Add null check before calling toLowerCase() on username parameter to prevent TypeError when 7TV entitlement.delete events lack Kick connection data.
Summary
streamerData.idtostreamerData.user_idin connectionManager.jsRoot Cause
The shared WebSocket connection manager was using
chatroom.streamerData.idinstead ofchatroom.streamerData.user_idfor 7TV cosmetic subscriptions. This caused cosmetic events (entitlement.create,entitlement.delete,cosmetic.create) to be sent to wrong channels, so they were never received by KickTalk.The original non-shared STV implementation was correctly using
user_id, but the migration to shared connections introduced this bug.Changes
utils/services/connectionManager.jslines 309 and 589 to usestreamerData.user_idTest Plan
Summary by CodeRabbit